#include "RandomData.h"
using namespace std;
RandomData::RandomData()
{
    for (long i = 0; i <= MAXSIZE; ++i)
        this -> array[i] = 0;
}
void RandomData::generatePseudoData(long n)
{
    FILE *fp = fopen("PseudoData.txt", "r+");
    srand((unsigned)time(NULL));
    for (long i = 0; i < n; ++i)
        fprintf(fp, "%d ",  rand());
    fclose(fp);
}
void RandomData::readRandomDataFile(const char filename[], long n)
{
    ifstream f(filename);
    long i = 0, nr;
    while (i < n)
    {
        f >> nr;
        this -> array[i] = nr;
        ++i;
    }
    f.close();
}
long* RandomData::getRandomData(long n)
{
    long *p = new long[n];
    for (long i = 0; i < n; ++i)
        p[i] = this -> array [i];
    return p;
}
void RandomData::generateWorstCaseData(long n)
{
    FILE *fp = fopen("WorstCaseData.txt", "r+");
    while (n > 0)
    {
        fprintf(fp, "%ld ",  n);
        --n;
    }
    fclose(fp);
}

